<template>
	<view class="store-type">
		<!-- 开店类型 -->
		<view class="header">
			<view>
				<text id="1" @click="check($event.target.id)" class="type" :class="choose==1?'choose':''">
					<text>{{i18n.Gratis}}</text>
					<text class="line"></text>
				</text>
				<text id="2" @click="check($event.target.id)" class="type" :class="choose==2?'choose':''">
					<text>{{i18n.Vip}}</text>
					<text class="line"></text>
				</text>
			</view>
		</view>
		<common-type v-if="choose==1"></common-type>
		<member-type v-if="choose==2"></member-type>
	</view>
</template>

<script>
	const globalData = getApp().globalData;
	import {open_state} from '@/api/store.js';
	import commonType from '@/components/getstore-type/common-type/index'
	import memberType from '@/components/getstore-type/member-type/index'
	export default {
		components:{
			commonType,
			memberType
		},
		computed: {
		   i18n() {
		    return globalData.$t('store_type');
		   },
		  },
		data() {
			return {
				choose:1,
			}
		},
		methods: {
			check:function(e){
				this.choose=e;
			},
			// getstoreid:function(){
			// 	let that =this
			// 	open_state().then(res=>{
			// 		if(res.status==200){
			// 			switch(res.data.open_state){
			// 				case 1:
			// 					uni.redirectTo({
			// 					    url: '/pages/store/setupshop/index'
			// 					});
			// 				break;
			// 				case 4:
			// 					uni.redirectTo({
			// 					    url: '/pages/store/supplier_store/index'
			// 					});
			// 				break;
			// 			}
			// 		}
			// 	}).catch(err=>{
			// 		return that.$util.Tips({
			// 			title: err
			// 		});
			// 	})
			// }
		},
		onShow(){
			this.getstoreid()
		}
	}
</script>

<style lang="scss" scoped>
.header{
	height: 135rpx;
	background-color: #FFFFFF;
}
.header view{
	display: inline-block;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
}
.header view .type:nth-child(1){
	margin-right: 140rpx;
}
.type{
	margin-top: 40rpx;
	font-size: 36rpx;
	font-weight: bold;
	text{
		display: flex;
		justify-content: center;
	}
}
.choose{
		color: #FD342A;
		.line{
			margin: 0 auto;
			margin-top: 20rpx;
			height: 8rpx;
			width: 32rpx;
			background-color: #FD342A;
			border-radius: 8rpx;
		}
	}
</style>
